---
title: "Winter 2022 Thursday Hearing Screenings"
output:
flexdashboard::flex_dashboard:
orientation: rows
social: menu
source_code: embed
vertical_layout: scroll
theme:
version: 4
bg: "#101010"
fg: "#101010"
primary: "#ED79F9"
navbar-bg: "#3ADAC6"
---
```{r setup, include=FALSE}
library(flexdashboard)
```
```{r, include=FALSE}
library(tidyverse)
library(here)
library(janitor)
library(rio)
library(colorblindr)
library(gghighlight)
library(forcats)
library(ggrepel)
library(gt)
library(knitr)
library(kableExtra)
library(reactable)
library(plotly)
library(glue)
library(fs)
library(rstatix)
library(ggpubr)
library(writexl)
library(remotes)
library(profvis)
theme_set(theme_minimal(15) +
theme(legend.position = "bottom",
panel.grid.major.x = element_line(colour = "gray60"),
panel.grid.minor.x = element_blank(),
panel.grid.major.y = element_blank())
)
```
```{r, include=FALSE}
ear <- import(here("data", "hearing_screening.sav"),
setclass = "tbl_df") %>%
characterize() %>%
janitor::clean_names() %>%
mutate(grade = as.factor(grade),
school = as.factor(school),
screen_res = as.factor(screen_res))
str(ear)
ear$grade <- factor(ear$grade, levels = c("kindergarten",
"1st grade",
"2nd grade"))
ear$screen_res <- factor(ear$screen_res, levels = c("pass",
"pass with OAE",
"refer",
"absent"))
ear$school
ear$school <- factor(ear$school, levels = c("Twin Oaks",
"McCornack",
"River Road",
"Buena Vista"))
ear_res <- ear %>%
group_by(grade, school) %>%
count(screen_res)
ear %>%
group_by(screen_res) %>%
count()
screen_stat <- ear_res %>%
mutate(screened = screen_res == "pass" &
screen_res == "pass with OAE" &
screen_res == "refer",
absent = screen_res == "absent")
screen_stat2 <- ear %>%
group_by(screen_res, school) %>%
count() %>%
pivot_wider(
names_from = screen_res,
values_from = n
) %>%
mutate(screened = sum(`pass` + `pass with OAE` + refer),
total_passed = sum(`pass` + `pass with OAE`),
pass_pct = (total_passed / screened)) %>%
select(1, 2, 3, 7, 4, 6, 5, 8)
screen_stat3 <- ear %>%
group_by(screen_res, grade) %>%
count() %>%
pivot_wider(
names_from = screen_res,
values_from = n
) %>%
mutate(screened = sum(`pass` + `pass with OAE` + refer),
total_passed = sum(`pass` + `pass with OAE`),
pass_pct = (total_passed / screened)) %>%
select(1, 2, 3, 7, 4, 6, 5, 8)
```
# Results
Row {.tabset}
-----------------------------------------------------------------------
```{r, include=FALSE}
ear_grade <- ear %>%
group_by(grade) %>%
count()
ear_school <- ear %>%
group_by(school) %>%
count()
```
```{r, include=FALSE}
grd_tbl <- ear_grade %>%
reactable(columns = list(
grade = colDef(name = "Grade",
align = "center"),
n = colDef(name = "Total",
align = "center",
format = colFormat(suffix = " students"))
),
striped = TRUE,
outlined = TRUE,
compact = TRUE,
highlight = TRUE,
bordered = TRUE)
grd_tbl2 <- screen_stat3 %>%
reactable(
columns = list(
grade = colDef(name = "Grade",
align = "center"),
pass = colDef(name = "Total Passed with Pure Tone",
align = "center"),
`pass with OAE` = colDef(name = "Total Passed with OAE",
align = "center"),
`total_passed` = colDef(name = "Total Passed",
align = "center"),
refer = colDef(name = "Total Referred",
align = "center"),
screened = colDef(name = "Total Screened",
align = "center"),
absent = colDef(name = "Total Absent",
align = "center"),
pass_pct = colDef(name = "Pass Rate",
align = "center",
format = colFormat(percent = TRUE, digits = 2))),
striped = TRUE,
outlined = TRUE,
compact = TRUE,
highlight = TRUE,
bordered = TRUE
)
sch_tbl <- ear_school %>%
reactable(columns = list(
school = colDef(name = "School",
align = "center"),
n = colDef(name = "Total",
align = "center",
format = colFormat(suffix = " students"))
),
striped = TRUE,
outlined = TRUE,
compact = TRUE,
highlight = TRUE,
bordered = TRUE)
sch_tbl2 <- screen_stat2 %>%
reactable(
columns = list(
school = colDef(name = "School",
align = "center"),
pass = colDef(name = "Total Passed with Pure Tone",
align = "center"),
`pass with OAE` = colDef(name = "Total Passed with OAE",
align = "center"),
`total_passed` = colDef(name = "Total Passed",
align = "center"),
refer = colDef(name = "Total Referred",
align = "center"),
screened = colDef(name = "Total Screened",
align = "center"),
absent = colDef(name = "Total Absent",
align = "center"),
pass_pct = colDef(name = "Pass Rate",
align = "center",
format = colFormat(percent = TRUE, digits = 2))),
striped = TRUE,
outlined = TRUE,
compact = TRUE,
highlight = TRUE,
bordered = TRUE
)
```
### School
```{r, include=TRUE}
sch_tbl2
```
### Grade
```{r, include=TRUE}
grd_tbl2
```
Row {.tabset}
-----------------------------------------------------------------------
### Screening Results
```{r, include=FALSE}
res_tbl <- ear_res %>%
reactable(columns = list(
grade = colDef(name = "Grade",
align = "center"),
school = colDef(name = "School",
align = "center"),
screen_res = colDef(name = "Screening Result",
align = "center"),
n = colDef(name = "Total",
align = "center",
format = colFormat(suffix = " students"))),
striped = TRUE,
outlined = TRUE,
compact = TRUE,
highlight = TRUE,
bordered = TRUE,
searchable = TRUE)
```
```{r, include=TRUE}
res_tbl
```